<table class="table table-border table-bordered table-hover table-bg">
	<thead>
		<tr class="text-c">
			<th>编号</th>
			<th>房间号</th>
			<th>类型</th>
			<th>设备ID</th>
			<th>原始起数</th>
			<th>费率</th>
			<th>最后抄表数</th>
			<th>抄表时间</th>
			<th>状态</th>
			<th>建档时间</th>
			<th>建档人</th>
			<th>操作</th>
		</tr>
	</thead>
	<tbody>
		<?php if(is_array($list) && count($list)){ foreach($list as $k=>$ls){ ?>
			<?php $rowspan = count($ls['list']); foreach($ls['list'] as $kk=>$lls){ ?>
				<tr class="text-c">
				<?php if($kk==0){ ?>
					<td rowspan="{$rowspan}" style="background-color: #ffffff"><?php echo ($page-1)*C('PAGE_SIZE')+($k+1); ?></td>
					<td rowspan="{$rowspan}" style="background-color: #ffffff">{$ls['roomnumber']}</td>
				<?php } ?>
					<td>{$lls['eqmtitle']}</td>
					<td>{$lls['eqmnumber']}</td>
					<td>{$lls['start_number']}</td>
					<td>{$lls['rates']}</td>
					<td>{$lls['last_number']/10}</td>
					<td><?php echo date('Y-m-d H:i', $lls['updatetime']); ?></td>
					<td id="st_{$lls['id']}"><?php echo $lls['status'] ? '启用' : '停用'; ?></td>
					<td><?php echo date('Y-m-d H:i', $lls['createtime']); ?></td>
					<td>{$lls['user_nick']}</td>
					<td>
						<a href="javascript:void(0);" class="act" vl="1" ids="{$lls['id']}">启用</a> | 
						<a href="javascript:void(0);" class="act" vl="0" ids="{$lls['id']}">停用</a> |
						<a href="javascript:void(0);" class="edit" onclick="admin_role_edit('设备编辑','index.html?id={$lls['id']}','1')" ids="{$lls['id']}">编辑</a>
					</td>
				</td>
			<?php } ?>
		<?php }}else{ ?>
		<tr class="text-c">
			<td colspan="14">暂无数据...</td>
		</tr>
		<?php } ?>
	</tbody>
</table>
<!--page-->
<include file="Common/page" />
<script>
	$(document).ready(function(){
		$("a.delete").on('click', function(){
			if (confirm("确认删除？") == true){
				var obj = $(this);
				var room_id = obj.attr('room_id');
				layer.load(2);
				$.post("remove.html",{id: room_id}, function(data){
					if(data/1){
						layer.msg('删除成功', {icon: 1, time: 2000}, function(){
							obj.parent('td').parent('tr').remove();
						});
					}else{
						layer.msg('删除失败', {icon: 2, time: 2000});
					}
				});
			}
		});
		
		//修改状态
		$(".act").on('click', function(){
			var obj = $(this);
			var	status = obj.attr('vl');
			var	id = obj.attr('ids');
			$.post('eqment/setstatus.html', {id: id, status: status}, function(data){
				if(data/1){
					var shtml = status/1 == 1 ? '启用' : '停用';
					$("#st_"+ id).html(shtml);
				}
			});
		});
	});
</script>